<%@ page language="java" errorPage="/common/error.jsp" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%@ page isELIgnored="false" %>
<%@ include file="/common/taglibs.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Pragma" content="no-cache">
<link href="../style.css" rel="stylesheet" type="text/css">
<link href="<c:url value='/admin/assets/style/jqueryform.css'/>" type="text/css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" media="screen" href="<c:url value='/admin/assets/js/jquery/jquery-validate.password/jquery.validate.password.css'/>" />

<script type="text/javascript" src="/admin/assets/js/util.js"></script>
<script type="text/javascript" src="<c:url value='/admin/assets/js/jquery/jquery.js'/>"></script>
<script type="text/javascript" src="<c:url value='/admin/assets/js/jquery/jquery-validate/lib/jquery.metadata.js'/>"></script>
<script type="text/javascript" src="<c:url value='/admin/assets/js/jquery/jquery-validate/jquery.validate.js'/>"></script>
<script type="text/javascript" src="<c:url value='/admin/assets/js/jquery/jquery-validate.password/jquery.validate.password.js'/>"></script>

<script type="text/javascript" language="javascript">
// <![CDATA[
$(document).ready(function() {
	var validator = $("#adminAddForm").validate({
		rules: {
			userName: 	        	{required: true , remote: "<c:url value='/admin/system/admin-checkUserName.ac'/>"},
			password: 		        {required: true,	minlength: 5 , maxlength: 50, password: true},
			password_confirm: 		{required: true,	minlength: 5 , maxlength: 50, equalTo: "#password" },
			mobile:					{required: true, 	digits: true },
			email:					{required: true,	email: true}
		},
		messages: {
					userName: { 
						required:"请输入用户名. ",
						remote: "您输入的用户已经存在."
					},
					password: {
						required: "请输入新密码. ",
						minlength:"新密码 最少是 5 个字符",
						maxlength:"新密码 最多是 50 个字符"
					},
					password_confirm: {
						required: "请输入确认密码. ",
						minlength:"确认密码 最少是 5 个字符",
						maxlength:"确认密码 最多是 50 个字符",
						equalTo:"两次输入的密码必须相同"
					},
					mobile: {
						required: "请输入手机号码. ",
						digits: "手机号码必须是数字."
					},
					email: {
						required: "请输入Email. ",
						email: "请输入一个合法的Email."
					}
		},
		// the errorPlacement has to take the table layout into account
		errorPlacement: function(error, element) {
			error.prependTo( element.parent().next() );
		},
		submitHandler:function(form){
            $("#errorTd").html("");
            form.submit();
        },
		// set this class to error-labels to indicate valid fields
		success: function(label) {
			// set &nbsp; as text for IE
			label.html("&nbsp;").addClass("checked");
		}     
	});
	
	
<c:if test="${not empty requestScope.message}">
$("#infoSpan").html("<img src='<c:url value='/admin/assets/images/warning.gif'/>'><font color='#C00000'><c:out value='${requestScope.message}' escapeXml='false'/></font>");
</c:if>

});

// ]]>
</script>
</head>
<body class="main">
<form method="post" name="adminAddForm" id="adminAddForm" action="<c:url value='/admin/system/admin-add.ac'/>">
<table class="container" cellpadding="0" cellspacing="0">
<tr><td>
<table class="dialog" align="center" cellpadding="0" cellspacing="0" width="700">
<tr><td>
<table class="header" cellpadding="0" cellspacing="0">
<tr>
<td>新增管理员</td>
</tr>
</table>
</td></tr>
<tr>
  <td class="body">
<table class="body" cellpadding="0" cellspacing="0">
<tr>
  <td colspan="2" align="center" id="errorTd">&nbsp;<span id="infoSpan" class="infoSpan">&nbsp;</span></td>
  <tr>
  <td width="30%" align="right"><strong>用户名：</strong></td>
  <td><input type="text" name="userName" id="userName" size="31" maxlength="31" value=""><label class="error" for="userName" generated="true" ></label>
</tr>
<tr>
<td align="right"><b>密码：</b></td>
<td><input type="password" name="password" id="password" size="31" maxlength="31" value="">
<label class="error" for="password" generated="true" style="display:none"></label> 
<div class="password-meter">
    <div class="password-meter-message">&nbsp;</div>
    <div class="password-meter-bg">
        <div class="password-meter-bar"></div>
    </div>
</div>
</tr>
<tr>
<td align="right"><b>确认密码：</b></td>
<td><input type="password" name="password_confirm" id="password_confirm" size="31" maxlength="31" value=""><label class="error" for="password_confirm" generated="true" ></label>
</tr>
<tr>
<td align="right"><b>手机号码：</b></td>
<td><input type="text" name="mobile" id="mobile" size="31" maxlength="31" value=""><label class="error" for="mobile" generated="true" ></label>
</tr>
<tr>
  <td align="right"><strong>电子邮件：</strong></td>
  <td><input type="text" name="email" id="email" size="31" maxlength="31" value="">  <label class="error" for="email" generated="true" ></label>
</tr>
<tr>
  <td>&nbsp;</td>
  <td>
</tr>
</table>
</td></tr>
<tr><td>
<table class="footer" cellpadding="0" cellspacing="0">
<tr><td>
<input class="button" type="submit" value="确定">
&nbsp;&nbsp;<input class="button" type="button" value="返回" onClick="document.location='javascript:history.go(-1)'">
</td></tr>
</table>
</td></tr>
</table>
</td></tr>
</table>
</form>

</body>
</html>
